/**
 * 
 */
package tarena.netctoss.service.impl;

import java.util.List;

import tarena.netctoss.dao.Pagination;
import tarena.netctoss.dao.UserCondition;
import tarena.netctoss.dao.UserDao;
import tarena.netctoss.po.User;
import tarena.netctoss.service.UserService;

/**
 * 用户帐务管理模块业务层实现类
 * 
 * @author Wangpeihu
 * @team [Never give up]
 * @since JDK1.6(建议)
 * @date 2010-3-5
 */

public class UserServiceImpl implements UserService {

	private UserDao userDao;

	/**
	 * 依赖注入使用
	 * 
	 * @param userDao
	 */
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tarena.netctoss.service.UserService#delete(tarena.netctoss.po.User)
	 */
	@Override
	public void delete(User User) {
		userDao.delete(User);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * tarena.netctoss.service.UserService#findAll(tarena.netctoss.dao.UserCondition
	 * )
	 */
	@Override
	public List<User> findAll(UserCondition userCondition) {
		List<User> userList = userDao.findAll(userCondition);
		return userList;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tarena.netctoss.service.UserService#findById(java.lang.Integer)
	 */
	@Override
	public User findById(Integer id) {
		User user = userDao.findById(id);
		return user;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tarena.netctoss.service.UserService#save(tarena.netctoss.po.User)
	 */
	@Override
	public void save(User User) {
		userDao.save(User);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tarena.netctoss.service.UserService#update(tarena.netctoss.po.User)
	 */
	@Override
	public void update(User User) {
		userDao.update(User);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tarena.netctoss.service.UserService#findAll()
	 */
	@Override
	public List<User> findAll() {
		return userDao.findAll();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * tarena.netctoss.service.UserService#findAll(tarena.netctoss.dao.UserCondition
	 * , tarena.netctoss.dao.Pagination)
	 */
	@Override
	public List<User> findAll(UserCondition userCondition, Pagination page) {
		userDao.loadMaxPage(page, userCondition); // 加载最大页页号
		return userDao.findAll(userCondition, page);
	}

}
